package cn.edu.fudan.analyze;

import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import cn.edu.fudan.data.ExtractFeature;
import cn.edu.fudan.data.ReadData;
import cn.edu.fudan.tools.ClassifierSummary;
import cn.edu.fudan.tools.GetConfig;
import cn.edu.fudan.type.Config;
import cn.edu.fudan.type.DataItem;
import cn.edu.fudan.type.Feature;

public class ExplosionAnalyze {
	public static void main(String[] args) throws IOException{
		Config config = new GetConfig().getConfig();
		ReadData readData = new ReadData();
		ExtractFeature extractFeature = new ExtractFeature();

		String path = config.getPath();

		for (int i = 1; i < 15440; i++) {
			String filePath = path + "data\\" + i;			
			try {
				List<DataItem> rawdata = readData.readDataFromFile(filePath, true);
				Feature feature = extractFeature.getFeature(rawdata, config.getThreshold_window(), config.getProbability(),
						config.getInterval());
				FileWriter fWriter = new FileWriter(path+ "dataset\\burst\\"+i);
				for(DataItem dItem : feature.getBurst()){
					fWriter.write(dItem.getTimestamp()+"\t"+dItem.getValue()+"\r\n");
				}
				fWriter.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}
		


	}
}
